<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <ul id="box">
       
    </ul>
    <script>
        //  2。将json字符串 转回对象   JSON.parse()
        var str=localStorage.stararr;
        console.log(str)

        var arr=JSON.parse(str) //把json字符串转回数组
        console.log(arr)

        var  uls=document.querySelector("#box");

        for(var i=0;i<arr.length;i++){
            uls.innerHTML+=` <li>
                    <span>${arr[i].name}</span> ----------- <span>${arr[i].age}</span>
             </li>`
        }

    </script>
</body>
</html>